doctype html
html(lang='zh_CN', style='overflow: hidden;')
    head
        meta(http-equiv='X-UA-Compatible', content='IE=edge')
        // Set render engine for 360 browser
        meta(name='renderer', content='webkit')
        meta(charset='utf-8')
        title ThinkCMF {:lang('ADMIN_CENTER')}
        meta(name='description', content='This is page-header (.page-header > h1)')
        meta(name='viewport', content='width=device-width, initial-scale=1.0')
        link(href='__TMPL__/public/assets/themes/{:cmf_get_admin_style()}/bootstrap.min.css', rel='stylesheet')
        link(href='__TMPL__/public/assets/custom-boot4/css/simplebootadmin.css', rel='stylesheet')
        link(href='__STATIC__/font-awesome/css/font-awesome.min.css?page=index', rel='stylesheet', type='text/css')
        link(rel='stylesheet', href='__TMPL__/public/assets/themes/{:cmf_get_admin_style()}/simplebootadminindex.css')
        script.
            //全局变量
            var GV = {
                HOST: "{$_SERVER['HTTP_HOST']|default=''}",
                ROOT: "__ROOT__/",
                WEB_ROOT: "__WEB_ROOT__/",
                JS_ROOT: "static/js/"
            };
    body
        php $submenus=$menus;
            | if (!function_exists('getsubmenu')) {
            | function getsubmenu($submenus){
        notempty(name='submenus')
            php foreach($submenus as $menu){
            li
                php
                    | $menu_name=lang($menu['lang']);
                    | $menu_name=$menu['lang']==$menu_name?$menu['name']:$menu_name;
                php if(empty($menu['items'])){
                a(href="javascript:openapp('{$menu.url}','{$menu.id}','{$menu_name}',true);")
                    i.fa(class="fa-{$menu.icon|default='desktop'}")
                    span.menu-text  {$menu_name}
                php }else{
                a.dropdown-toggle(href='#' aria-haspopup="false")
                    i.fa.normal(class="fa-{$menu.icon|default='desktop'}")
                    span.menu-text.normal  {$menu_name}
                    b.arrow.fa.fa-angle-right.normal
                    i.fa.fa-reply.back
                    span.menu-text.back 返回
                ul.submenu.list-unstyled
                    php getsubmenu1($menu['items'])
                php }
            php }
        php }}
        php
            | if (!function_exists('getsubmenu1')) {
            | function getsubmenu1($submenus){
        php foreach($submenus as $menu){
        li
            php
                | $menu_name=lang($menu['lang']);
                | $menu_name=$menu['lang']==$menu_name?$menu['name']:$menu_name;
            php if(empty($menu['items'])){
            a(href="javascript:openapp('{$menu.url}','{$menu.id}','{$menu_name}',true);")
                i.fa.fa-caret-right
                span.menu-text
                    | {$menu_name}
            php }else{
            a.dropdown-toggle(href='#' aria-haspopup="false")
                i.fa.fa-caret-right
                span.menu-text
                    | {$menu_name}
                b.arrow.fa.fa-angle-right
            ul.submenu
                php getsubmenu2($menu['items'])
            php }
        php }
        php }}
        php
            | if (!function_exists('getsubmenu2')) {
            | function getsubmenu2($submenus){
        php foreach($submenus as $menu){
        li
            php
                | $menu_name=lang($menu['lang']);
                | $menu_name=$menu['lang']==$menu_name?$menu['name']:$menu_name;
            a(href="javascript:openapp('{$menu.url}','{$menu.id}','{$menu_name}',true);")
                i.fa.fa-angle-double-right
                span.menu-text
                    | {$menu_name}
        php }
        php }}
        if(condition = 'APP_DEBUG')
            style.
                #think_page_trace_open {
                    left: 0 !important;
                    right: initial !important;
                }
        //- #loading
            i.loadingicon
            span {:lang('LOADING')}
        #right-tools-wrapper
        header.navbar.navbar-expand-lg.navbar-dark.bg-secondary.p-0
            a.navbar-brand(href="{:url('admin/index/index')}", style='min-width: 200px;text-align: center;') ThinkCMF
            button.navbar-toggler(type='button', data-toggle='collapse', data-target='#navbar-main', aria-controls='navbar-main', aria-expanded='false', aria-label='Toggle navigation')
                span.navbar-toggler-icon
            #navbar-main.navbar-collapse.collapse
                ul.navbar-nav.justify-content-between.w-100
                    // 导航标签
                    li#task-main-menu.nav-item
                        a#task-pre.task-changebt
                            i.fa.fa-chevron-left
                        #task-content
                            ul#task-content-inner.navbar-nav.cmf-component-tab
                                li.cmf-component-tabitem.noclose(app-id='0', app-url="{:url('main/index')}", app-name='首页')
                                    a.cmf-tabs-item-text.nav-link {:lang('HOME')}
                        a#task-next.task-changebt
                            i.fa.fa-chevron-right
                    // 登录状态
                    li#login-bar.nav-item.pr-5
                        ul.list-unstyled.mb-0.d-flex.align-content-center
                            li#close-all-tabs-btn
                                a.nav-link#close-wrapper(href='javascript:void(0);', title="{:lang('CLOSE_TOP_MENU')}")
                                    i.fa.fa-times.right_tool_icon
                            li
                                a.nav-link#refresh-wrapper(href='javacript:void(0);', title="{:lang('REFRESH_CURRENT_PAGE')}", style='color:#fff;font-size: 16px')
                                    i.fa.fa-refresh.right_tool_icon
                            li.light-blue.dropdown
                                a.nav-link.dropdown-toggle(data-toggle='dropdown', href='#')
                                    <if condition="isset($admin['avatar']) && $admin['avatar']">
                                    img.nav-user-photo(src="{:cmf_get_user_avatar_url($admin['avatar'])}", alt='{$admin.user_login}')
                                    <else />
                                    img.nav-user-photo(src='__TMPL__/public/assets/images/logo-18.png', alt="{$admin.user_login|default=''}")
                                    </if>
                                    span.user-info
                                        | {:lang('WELCOME_USER',array('user_nickname' => empty($admin['user_nickname'] )? $admin['user_login'] : $admin['user_nickname']))}
                                    //i.fa.fa-caret-down
                                .user-menu.dropdown-menu.dropdown-yellow
                                    <if condition="cmf_auth_check(cmf_get_current_admin_id(),'admin/Setting/site')">
                                    a.dropdown-item(href="javascript:openapp('{:url('setting/site')}','index_site','{:lang('ADMIN_SETTING_SITE')}');")
                                        i.fa.fa-cog
                                        |{:lang('ADMIN_SETTING_SITE')}
                                    </if>
                                    <if condition="cmf_auth_check(cmf_get_current_admin_id(),'admin/user/userinfo')">
                                    a.dropdown-item(href="javascript:openapp('{:url('user/userinfo')}','index_userinfo','{:lang('ADMIN_USER_USERINFO')}');")
                                        i.fa.fa-user
                                        |  {:lang('ADMIN_USER_USERINFO')}
                                    </if>
                                    <if condition="cmf_auth_check(cmf_get_current_admin_id(),'admin/Setting/password')">
                                    a.dropdown-item(href="javascript:openapp('{:url('setting/password')}','index_password','{:lang('ADMIN_SETTING_PASSWORD')}');")
                                        i.fa.fa-lock
                                        |  {:lang('ADMIN_SETTING_PASSWORD')}
                                    </if>
                                    a.dropdown-item(href="{:url('Public/logout')}")
                                        i.fa.fa-sign-out
                                        |  {:lang('LOGOUT')}
        .container-fluid
            .row
                .col#sidebar.sidebar
                    ul.row.list-unstyled#sidebar-shortcuts.sidebar-shortcuts.no-gutters.p-1
                        li.col
                            a.btn.btn-sm.btn-warning(href='__ROOT__/', title="{:lang('WEBSITE_HOME_PAGE')}", target='_blank', data-toggle='tooltip')
                                i.fa.fa-home
                        li.col
                            <if condition="cmf_auth_check(cmf_get_current_admin_id(),'user/AdminAsset/index')">
                            a.btn.btn-sm.btn-info(href="javascript:openapp('{:url('user/AdminAsset/index')}','userAdminAssetindex','资源管理',true);", title='资源管理', data-toggle='tooltip')
                                i.fa.fa-file
                            </if>
                        li.col
                            <if condition="cmf_auth_check(cmf_get_current_admin_id(),'admin/Setting/clearcache')">
                            a.btn.btn-sm.btn-danger(href="javascript:openapp('{:url('admin/Setting/clearcache')}','index_clearcache','{:lang('ADMIN_SETTING_CLEARCACHE')}',true);", title="{:lang('ADMIN_SETTING_CLEARCACHE')}", data-toggle='tooltip')
                                i.fa.fa-trash-o
                            </if>
                        li.col
                            <if condition="cmf_auth_check(cmf_get_current_admin_id(),'admin/RecycleBin/index')">
                            a.btn.btn-sm.btn-danger(href="javascript:openapp('{:url('admin/RecycleBin/index')}','index_recycle','回收站',true);", title='回收站', data-toggle='tooltip')
                                i.fa.fa-recycle
                            </if>
                        li.col
                            <if condition="APP_DEBUG">
                            a.btn.btn-sm.btn-dark(href="javascript:openapp('{:url('admin/Menu/index')}','index_menu','{:lang('ADMIN_MENU_INDEX')}',true);", title="{:lang('ADMIN_MENU_INDEX')}", data-toggle='tooltip')
                                i.fa.fa-list
                            </if>
                    #nav-wrapper.row
                        .col-12
                            ul.nav-list.list-unstyled
                                | {:getsubmenu($submenus)}
                .main-content.col
                    #content.page-content
                        iframe#appiframe-0.appiframe(src="{:url('Main/index')}", style='width:100%;height: 100%;', frameborder='0')
        script(src='__TMPL__/public/assets/js/jquery-3.4.1.min.js')
        script(src='__STATIC__/js/wind.js')
        script(src='__TMPL__/public/assets/js/bootstrap.bundle.min.js')
        script(src='__STATIC__/js/admin.js')
        script(src='__TMPL__/public/assets/custom-boot4/js/adminindex.js')
        script.
            console.log("document 宽度："+$(document).width());
            console.log("window 宽度："+$(window).width())
        script
            | $(function () {
            |    $("[data-toggle='tooltip']").tooltip();
            |    $("li.dropdown").hover(function () {
            |        $(this).addClass("open");
            |    }, function () {
            |        $(this).removeClass("open");
            |    });
            |    var menus = {:$menus_js_var};
            |    //读取url参数。尝试执行菜单功能。
            |    if (typeof (menus) != "undefined") {
            |        var tw = window.top;
            |        var twa = tw.location.href.split("#");
            |        var url = twa[1];
            |        var urlTmp = url;
            |        if (url != null) {
            |            //去掉/ 去掉_ 全部小写。
            |            urlTmp = urlTmp.replace(/[\\\/|_|]/g, "");
            |            urlTmp = urlTmp.replace(".html", "");
            |            var menu = menus[urlTmp];
            |            if (menu) {
            |                openapp(url, menu.id + menu.app, menu.name, true);
            |            }
            |        }
            |    }
            | });
            | var ismenumin = $("#sidebar").hasClass("menu-min");
            | $(".nav-list").on("click", function (event) {
            |    var closest_a = $(event.target).closest("a");
            |    if (!closest_a || closest_a.length == 0) {
            |        return
            |    }
            |    if (!closest_a.hasClass("dropdown-toggle")) {
            |        if (ismenumin && "click" == "tap" && closest_a.get(0).parentNode.parentNode == this) {
            |            var closest_a_menu_text = closest_a.find(".menu-text").get(0);
            |            if (event.target != closest_a_menu_text && !$.contains(closest_a_menu_text, event.target)) {
            |                return false
            |            }
            |        }
            |        return
            |    }
            |    var closest_a_next = closest_a.next().get(0);
            |    if (!$(closest_a_next).is(":visible")) {
            |        var closest_ul = $(closest_a_next.parentNode).closest("ul");
            |        if (ismenumin && closest_ul.hasClass("nav-list")) {
            |            return
            |        }
            |        closest_ul.find("> .open > .submenu").each(function () {
            |            if (this != closest_a_next && !$(this.parentNode).hasClass("active")) {
            |                $(this).slideUp(150).parent().removeClass("open")
            |            }
            |        });
            |    }
            |    if (ismenumin && $(closest_a_next.parentNode.parentNode).hasClass("nav-list")) {
            |        return false;
            |    }
            |    $(closest_a_next).slideToggle(150).parent().toggleClass("open");
            |    return false;
            | });
|